<section class="content-header">
   <h1>
      <b>{$header}
          <small>>>{$desc}</small>
      </b>
    </h1>
</section>
<section class="content" id="pjax-container">
  <div class="box">
      <div class="box-header with-border">
        <h3 class="box-title"><b>短信记录列表</b></h3>&nbsp;&nbsp;共{$dataNum}条记录
            <form action="{:url('SnsMsg/msgLists', ['query' => 1])}" method="get" class="form-inline pull-right" role="form" data-pjax>
                <div class="form-group">
                    <label for="field-other" class="label-control">接收人手机号&nbsp;</label>
                    <input type="text" name="phone" id="" class="form-control input-sm" value="" placeholder="输入短信接收人手机号">
                </div>
                <div class="form-group">
                    <label for="field-other" class="label-control">&nbsp;短信编号&nbsp;</label>
                    <input type="text" name="msg_code" id="" class="form-control input-sm" value="" placeholder="输入发送编号">
                </div>
                <div class="form-group">
                    <label for="field-status" class="control-label">&nbsp;发送状态&nbsp;</label>
                    <select name="status" class="form-control input-sm">
                        <option value="-1">未选择</option>
                        <option value="1">成功发送</option>
                        <option value="0">发送失败</option>
                    </select>
                </div>
                <div class="form-group">
                    <label for="field-page" class="control-label">&nbsp;每页记录:&nbsp;</label>
                    <select name="pageSize" class="form-control input-sm">
                        <option value="10">10条</option>
                        <option value="20">20条</option>
                        <option value="30">30条</option>
                    </select>
                </div>
                <button type="submit" class="btn btn-success btn-sm">查询</button>
            </form>
      </div>
      <div class="box-body">
            <table class="table table-hover table-border">
                <thead>
                    <tr>
                        <th>发送编号</th>
                        <th>接收人手机号</th>
                        <th>发送内容</th>
                        <th>对应模板</th>
                        <th>重发次数</th>
                        <th>短信状态</th>
                        <th>发送时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {foreach $data as $v}
                    <tr>
                        <td>D{$v['id']}</td>
                        <td>{$v['phone']}</td>
                        <!-- 设置长度后的值用'...'代替 -->
                        <td>{$v['content']}</td>
                        <td>{$v['template_name']}</td>
                        <td>{$v['retry']}</td>
                        <td>
                            {eq name="v.status" value="0"}
                            <span class="label label-danger" style="cursor:pointer">发送失败</span>
                            {else/}
                            <span class="label label-success" style="cursor:pointer">成功</span>
                            {/eq}
                        </td>
                        <td>{$v['retry'] ? $v['update_at'] : $v['create_at'] }</td>
                        <td>
                            <button type="button" class="btn btn-sm btn-warning"  data-toggle="tooltip" data-placement="bottom" data-title="再次发送" onclick="handle.retry(this,{$v['id']})">再次发送
                          </button>
                        </td>
                    </tr>
                    {/foreach}
                </tbody>
            </table>
      </div>
      <div class="box-footer with-border">
            {$data->render()}
      </div>
  </div>
</section>
<script>
    var requestUrl = {
            retry : "{:url('SnsMsg/msgResend')}"
    };
    var handle = {
            retry : function(obj, id){
                $.post(requestUrl.retry, {id:id}, function(e) {
                    if(e.code) {

                    } else {
                        bayMax.warning(e.msg);
                    }
                })
            }
    };
</script>

